package com.lmc.chatroom.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class webConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/**/*.html", // 排除所有 HTML 文件
                        "/**/*.css",  // 排除所有 CSS 文件
                        "/**/*.js",   // 排除所有 JS 文件
                        "/img/*",
                        "/favicon.ico", // 排除网站图标
                        "/user/login",
                        "/user/register"
                );

    }
}
